package com.itcast.service.impl;

import com.itcast.dao.BookDao;
import com.itcast.domain.Book;
import com.itcast.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookServiceImpl implements BookService {
   @Autowired(required = false)
    private BookDao bookDao;
    @Override
    public boolean save(Book book) {
         bookDao.save(book);
         return true;
    }

    @Override
    public boolean update(Book book) {
        bookDao.update(book);
        return true;
    }

    @Override
    public boolean delete(int id) {
        bookDao.delete(id);
        return true;
    }

    @Override
    public Book getById(int id) {
        Book book = bookDao.getById(id);
        return book;
    }

    @Override
    public List<Book> getAll() {
        List<Book>  list= bookDao.getAll();
        return list;
    }
}
